package com.example.springmvc.controller;

import com.example.springmvc.model.UserInfo;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@RequestMapping("/response")
@Controller
public class ResponseController {

    @RequestMapping("/index")
    public String index() {
        return "/index.html";
    }
    @ResponseBody
    @RequestMapping("/returnData")
    public String returnData() {
        return "<h1>我是HTML代码</h1>";
    }

    @ResponseBody
    @RequestMapping("/returnJson")
    public UserInfo returnJson() {
        UserInfo userInfo = new UserInfo("zhangsan","123456",19);
        return userInfo;
    }


}

